var express = require('express')
var request = require('request')
var app = express()

app.use("/test",function(req,res){
    request("http://www.baidu.com",function(error,response,body){
        if(!error && response.statusCode == 200){
            // console.log(JSON.parse(body))
            
        }
    })

    console.log("test")
    res.send("send msg")
})

app.use(function(req,res,next){
    console.log("步骤一")
    res.writeHead(200,{"Content-Type":"text/plain"})
    next()
})

app.use(function(req,res){
    console.log("步骤二")
    res.end("Hello World!")
})

var server = app.listen(3000,function(){
    console.log("http server is ready on 3000")
})
